Put truenoHeadlights.cs into your scripts folder at the root of your gta 5 directory. If you don't have one then create a folder called scripts. Also you will need ScripthookV and ScripthookV.NET

Credits to stillHere for the automatic popupheadlights script!